<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<script src="jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="//cdn1.lncld.net/static/js/2.1.2/av-min.js"></script>
		<script src="common/js/vue.js"></script>
		<script src="common/js/new_file.js"></script>
		<script type="text/javascript">
			window.onload = function() {
				var APP_ID = 'c4w6bVvWfh8xxcmkBE1G0gIt-gzGzoHsz';
				var APP_KEY = 'JBikg4Ksk76zcTi5BKYWvTJF';
				AV.init({
					appId: APP_ID,
					appKey: APP_KEY
				});
				var query = new AV.Query('ELM_shop');
				query.include('owner');
				query.descending('createdAt');
				query.find().then(function(products) {
					for(var i = 0; i < products.length; i++) {
						var jop = {
								id: products[i].id,
								shopname: products[i].attributes.shopname,
								shophours: products[i].attributes.shophours,
								startprice: products[i].attributes.startprice,
								classify: products[i].attributes.classify,
								productclassify: products[i].attributes.productclassify,
								adress: products[i].attributes.adress,
								attr1: products[i].attributes.attr1,
								attr2: products[i].attributes.attr2,
								attr3: products[i].attributes.attr3,
								grade: products[i].attributes.grade,
								notice: products[i].attributes.notice,
								salenum: products[i].attributes.salenum,
								sendprice: products[i].attributes.sendprice,
								shophours: products[i].attributes.shophours,
							}
						newvue.shop.push(jop);
					}
						console.log(newvue.shop)
				}).catch(function(error) {
					alert(JSON.stringify(error));
				});
				
				var query = new AV.Query('ELM_product');
				query.include('owner');
				query.descending('createdAt');
				query.find().then(function(products) {
					// 查询到商品后，在前端展示到相应的位置中。
//										console.log(products)
					for(var h = 0; h < products.length; h++) {
						var jop = {
								id: products[h].id,
								productname: products[h].attributes.productname,
								classify: products[h].attributes.classify,
								grade: products[h].attributes.grade,
								salenum: products[h].attributes.salenum,
								price: products[h].attributes.price,
								salenum: products[h].attributes.salenum,
								shopid: products[h].attributes.shopid,
								remark: products[h].attributes.remark,
							}
							//					console.log(jop)
						newvue.product.push(jop);
					}
                        console.log(newvue.product)
				}).catch(function(error) {
					alert(JSON.stringify(error));
				});
			}
		</script>
	</body>

</html>